<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
      layout:decorate="~{admin/layout}">
<body>

<div  class="content-wrap" layout:fragment="content">
    <main id="content" class="content" role="main">
        <ol class="breadcrumb">
            <li>财务管理</li>
            <li class="active">死苗管理</li>
        </ol>
        <div class="row mb-lg">
            <div class="clearfix">
                <ul class="nav nav-tabs pull-xs-left" id="myTab" role="tablist">
                    <li class="nav-item">
                        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#basic" role="tab" aria-controls="basic" aria-expanded="true">待审核</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#assumtion" role="tab" aria-controls="assumtion" aria-expanded="false">死苗列表</a>
                    </li>
                </ul>
            </div>
            <div class="tab-content mb-lg" id="myTabContent">
                <div role="tabpanel" class="tab-pane active in clearfix" id="basic" aria-labelledby="basic-tab" aria-expanded="true">
                    <div class="widget-body">
                        <button id="dietree" class="btn btn-primary" style="background-color: #64bd63;background-color: #64bd63;border-color: #64bd63;">死苗确认</button>
                        <div id="priceandlocation" style="display: none">
                            当前市场价: <input type="text" id="price" /><br>
                            <input type="submit" id="priceadd">
                            <script>
                                $("#dietree").click(function () {
                                    $("#priceandlocation").toggle();
                                    console.log("log");
                                    $("#priceadd").click(function () {
                                        var str="";
                                        $(".cc").each(function (i, obj) {
                                            if($(this).is(':checked')){
                                                str=str+($(this).attr("id")+";");
                                            }
                                        });
                                        console.log(str);
                                        $.ajax({
                                            url: "/admin/finance/die/confirm",
                                            type: 'POST',
                                            data:{"treeids":str,"price":$("#price").val()},
                                            async: false,
                                            success: function (data) {
                                                console.log(data);
                                                location.reload();
                                            },
                                            error: function (xhr) {
                                                console.log("error")
                                            }
                                        });
                                    })
                                });
                            </script>
                        </div>
                        <div class="mt">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>
                                        <div class="checkbox abc-checkbox">
                                            <input id="checkbox1" type="checkbox" data-check-all>
                                            <label for="checkbox1"></label>
                                        </div>
                                    </th>
                                    <th class="hidden-sm-down">数量</th>
                                    <th class="hidden-sm-down">地块</th>
                                    <th class="hidden-sm-down">采购地</th>
                                    <th class="hidden-sm-down">树种</th>
                                    <th class="no-sort">入库时间</th>
                                    <th class="no-sort">撤销</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="tree:${trees5}">
                                    <td>
                                        <div class="checkbox abc-checkbox">
                                            <input class="cc" th:id="${tree.tree_id}" type="checkbox">
                                            <label th:for="${tree.tree_id}"></label>
                                        </div>
                                    </td>
                                    <td th:text="${tree.number}"></td>
                                    <td th:text="${tree.serialNumber}"></td>
                                    <td th:text="${tree.location}"></td>
                                    <td class="hidden-sm-down" th:text="${tree.treeSpecies}"></td>
                                    <td class="hidden-sm-down" th:text="*{#dates.format(tree.createtime,'yyyy-MM-dd')}"></td>
                                    <td>
                                        <a class="fa fa-rotate-right" style="color: #c20000;" th:href="@{/admin/finance/die/recover(tree_id=${tree.tree_id})}"></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="assumtion" role="tabpanel" aria-labelledby="assumtion-tab" aria-expanded="false">
                    <div class="widget-body">
                        <div class="mt">
                            <table   class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th class="hidden-sm-down">数量</th>
                                    <th>采购地</th>
                                    <th class="hidden-sm-down">树种</th>
                                    <th class="no-sort">入库时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="tree:${trees4}">
                                    <td th:text="${tree.number}"></td>
                                    <td th:text="${tree.location}"></td>
                                    <td class="hidden-sm-down" th:text="${tree.treeSpecies}"></td>
                                    <td class="hidden-sm-down" th:text="*{#dates.format(tree.createtime,'yyyy-MM-dd')}"></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
</div>
</body>
</html>